﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.PackageManagement;
using Digitalmes.Model.ProductManagement;

namespace Digitalmes.Model.PackageManagement
{
    /// <summary>
    /// 包装方案
    /// </summary>
	[Table("PackageScheme")]

    [Display(Name = "_Model.PackageScheme")]
    public class PackageScheme : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._PackageScheme._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._PackageScheme._Name")]
        [Comment("名称")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Name { get; set; }
        [Display(Name = "_Model._PackageScheme._Code")]
        [Comment("编码")]
        public string Code { get; set; }
        [Display(Name = "_Model._PackageScheme._ProductId")]
        [Comment("装箱产品")]
        public long? ProductId { get; set; }


        public Product Product { get; set; }    


        [Display(Name = "_Model._PackageScheme._ProductName")]
        [Comment("产品名称")]
        public string ProductName { get; set; }
        [Display(Name = "_Model._PackageScheme._Rules")]
        [Comment("条码校验规则")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string Rules { get; set; }
        [Display(Name = "_Model._PackageScheme._Qty")]
        [Comment("装箱数量")]
        [Precision(18,2)]
        [Required(ErrorMessage = "Validate.{0}required")]
        public decimal? Qty { get; set; }
        [Display(Name = "_Model._PackageScheme._EnablePrint")]
        [Comment("启用打标")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool? EnablePrint { get; set; }
        [Display(Name = "_Model._PackageScheme._SerialNumber")]
        [Comment("流水号")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public long? SerialNumber { get; set; }
        [Display(Name = "_Model._PackagePara._Scheme")]
        [InverseProperty("Scheme")]
        public List<PackagePara> PackagePara_Scheme { get; set; }
        [Display(Name = "_Model._PackageScheme._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
